package nio;

import java.nio.ByteBuffer;

/**
 * @author RJA
 * @version V1.0
 * @Title: nio.demo_1
 * @Description:
 * @date 2019/9/5 16:47
 */
public class NioTest07 {
    public static void main(String[] args) {
        ByteBuffer buffer = ByteBuffer.allocate(10);

        for (int i = 0; i < buffer.capacity();++i){
            buffer.put((byte) i);
        }

        ByteBuffer readOnlyBuffer = buffer.asReadOnlyBuffer();
        System.out.println(readOnlyBuffer.getClass());

        readOnlyBuffer.put((byte)2);
    }
}
